package com.aizuda.boot.modules.business.contract.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@Schema(description = "合同字段定义实体")
@NoArgsConstructor
@AllArgsConstructor
@TableName("contract_field")
public class ContractFieldEntity {
    @Schema(description = "字段ID", example = "1")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    
    @Schema(description = "父级字段ID", example = "0")
    private Long parentFieldId;
    
    @Schema(description = "字段名称", required = true, example = "合同金额")
    private String fieldName;

    @Schema(description = "字段唯一编码")
    private String code;
    
    @Schema(description = "字段类型", required = true, example = "NUMBER",
        allowableValues = "TEXT,NUMBER,DATE,SELECT,CHECKBOX,PERSON,DEPARTMENT,GROUP")
    private String fieldType;
    
    @Schema(description = "字段选项(JSON格式)", example = "['选项1','选项2']")
    private String fieldOptions;
    
    @Schema(description = "字段描述", example = "合同总金额字段")
    private String fieldDescription;
    
    @Schema(description = "是否启用", example = "true")
    private Boolean isEnabled;
    
    @Schema(description = "小数位数", example = "2")
    private Integer decimalPlaces;
    
    @Schema(description = "单位", example = "元")
    private String unit;
    
    @Schema(description = "选项子类型", example = "TEXT",
        allowableValues = "TEXT,NUMBER,LONG_TEXT")
    private String optionType;
    
    @Schema(description = "是否必填", example = "true")
    private Boolean isRequired;

    @Schema(description = "是否系统字段")
    private Boolean isSystem;
    
    @Schema(description = "创建时间", example = "2023-07-20 10:00:00")
    private Date createdAt;
    
    @Schema(description = "更新时间", example = "2023-07-20 11:00:00")
    private Date updatedAt;

    @Schema(description = "是否需要展示")
    private Boolean isShow = true;
}